“You use Git to take snapshots of all the files in a folder.”
07 Jan 2021
“You use Git to take snapshots of all the files in a folder.”
push to send the snapshots onlinepull to retrieve an updated snapshotgit!
git!
git!
git!
git!
git!
git!
git!
git!
git!
git!
git!
git!
gitgit --version in your terminalsudo apt install git-all in your terminalNote that you may need admin rights on your computer, without these you’ll need to request an install.
GitHub offers a range of account types. A free account is available for organisations and individuals.
Even if you’re in an institution, create a personal GitHub account to keep track of you own work.
You’ll find more information, and links for creating an account, here.
Follow the instructions here to create your first repository
Some key files to include:
README - ideally format this as a markdown md file (more info here and here)
LICENSE - how you want people to re-use your code (info)
.gitignore - names of any files in your project you don’t want on GitHub (templates)
git is traditionally a command line toolcd path/to/new/folder/ - use cd to move between folders (remember that “..” means go back one folder)ls - to list the files and folders in your current folder (dir in Windows)gitgit the most out of GitHubgit in the git handbookgit commandsgit glossary| Command | Definition |
|---|---|
git status
|
Check current status of local repository - is it up to date? |
git branch
|
List existing branches |
git branch [branchName]
|
Create new branch |
git branch -d [branchName]
|
Delete branch |
git checkout [branchName]
|
Switch to branch |
git fetch
|
Get latest version references for repository |
git checkout -t origin/[branchName]
|
Switch to remote branch (note you’ll need to run git fetch first) |
git push --set-upstream origin [branchName]
|
Push a branch online |
git add [FileName]
|
Stage file for committing |
git commit -m [message]
|
Commit staged changes to GitHub. Always add meaningful message. |
git push
|
Push committed changes to GitHub |
git pull
|
Pull changes from GitHub to local repository |
git rm [fileName]
|
Remove file and record |
git mv [fileName]
|
Move file and version history within repository |
git reset --hard HEAD^
|
Remove un-pushed commits |